package org.hao.samples.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "exam_user")
public class Student implements Serializable {
	private static final long serialVersionUID = -6530168542617015609L;

	@Id
	@Column(name = "user_id", nullable = false)
	private Integer user_id;

	@NotEmpty(message = "名字不能为空")
	@Column(name = "user_name", length = 45, nullable = false)
	private String user_name;

	@Column(name = "gender", length = 1, nullable = false)
	private Integer gender;

	@Column(name = "birthday", nullable = false)
	private Date birthday;

	@Pattern(regexp = "^[0-9]{11}$", message = "11位数字")
	@Column(name = "tel", length = 20, nullable = false)
	private String tel;

	@Column(name = "address", length = 255, nullable = false)
	private String address;

	@Column(name = "password", length = 20, nullable = false)
	private String password;

	@Column(name = "last_lock_time", length = 1, nullable = false)
	private Date last_lock_time;

	@Column(name = "login_fail_count", length = 1, nullable = false)
	private Integer login_fail_count;

	@OneToMany(mappedBy = "student")
	private Set<ExamUserSubject> examUserSubjects;

	@Column(name = "email", length = 25, nullable = false)
	private String email;

	public Student() {
		super();
	}

	public Student( String user_name, Integer gender, Date birthday, String tel, String address,
			String password, Date last_lock_time, Integer login_fail_count, String email) {
		super();
		this.user_name = user_name;
		this.gender = gender;
		this.birthday = birthday;
		this.tel = tel;
		this.address = address;
		this.password = password;
		this.last_lock_time = last_lock_time;
		this.login_fail_count = login_fail_count;
		this.email = email;
	}

	public Integer getUser_id() {
		return user_id;
	}

	public void setUser_id(Integer user_id) {
		this.user_id = user_id;
	}

	public String getUser_name() {
		return user_name;
	}

	public void setUser_name(String user_name) {
		this.user_name = user_name;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Set<ExamUserSubject> getExamUserSubjects() {
		return examUserSubjects;
	}

	public void setExamUserSubjects(Set<ExamUserSubject> examUserSubjects) {
		this.examUserSubjects = examUserSubjects;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Date getLast_lock_time() {
		return last_lock_time;
	}

	public void setLast_lock_time(Date last_lock_time) {
		this.last_lock_time = last_lock_time;
	}

	public Integer getLogin_fail_count() {
		return login_fail_count;
	}

	public void setLogin_fail_count(Integer login_fail_count) {
		this.login_fail_count = login_fail_count;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

}
